Hi everyone, I use an example found in the dxl documentation to get the history of each object of the current module. Our history is huge and we know that most of the time, what we are looking for is not in a old history. The thing is the for loop starts from the older history ... My question is then : is it possible to analyze the history starting from the most recent one ?
Object o
History hr
for o in current Module do
{
for hr in o do
{
[...code...]
//this loop start from older history and end by the most recent one
//is it possible to start by the latest ?
}
}
Thanks ! Joooris - Fri Jun 30 04:46:10 EDT 2017 |
Re: History - start from recent instead of old Here's a function I use to populate a skip list with the history entries, newest first. To create it, it needs to loop through all the history entries anyway, so not sure whether it would save you any processing time. A little example of usage is at the end...
void getHistoryEntriesNewestFirst(Object o, Skip &historyEntries)
{
if (null(o)) return
History h
int numHistoryEntries = 0
for h in o do
{
numHistoryEntries++
}
int historyEntryNumber = numHistoryEntries
for h in o do
{
put(historyEntries, historyEntryNumber--, h)
}
}
Skip historyEntries = create
getHistoryEntriesNewestFirst(current Object, historyEntries)
History h
for h in historyEntries do
{
// do your action here
}
|
Re: History - start from recent instead of old
Just a remark that I'm afraid won't help you much today: you could baseline your modules from time to time, that way you'll get rid of old history entries... |
Re: History - start from recent instead of old Mike.Scharnow - Fri Jun 30 07:18:15 EDT 2017
Just a remark that I'm afraid won't help you much today: you could baseline your modules from time to time, that way you'll get rid of old history entries... Hi,
Thanks for you reply :) In fact if I don't find what I want in the current module, it means it's in a baseline. So I also loop on all baseline of the current module, and this for loop (for baseline in current Module) also starts from the older baseline ! Which means I have the problem twice :). Everything is working, it is just a matter of performance.
|
Re: History - start from recent instead of old Antonio__Norkus - Fri Jun 30 07:04:27 EDT 2017 Here's a function I use to populate a skip list with the history entries, newest first. To create it, it needs to loop through all the history entries anyway, so not sure whether it would save you any processing time. A little example of usage is at the end...
void getHistoryEntriesNewestFirst(Object o, Skip &historyEntries)
{
if (null(o)) return
History h
int numHistoryEntries = 0
for h in o do
{
numHistoryEntries++
}
int historyEntryNumber = numHistoryEntries
for h in o do
{
put(historyEntries, historyEntryNumber--, h)
}
}
Skip historyEntries = create
getHistoryEntriesNewestFirst(current Object, historyEntries)
History h
for h in historyEntries do
{
// do your action here
}
Hi,
Good idea. I will bench it compared to what I currently have ! Thanks ! |